Skip to content

fix: reject unsupported filter conditions when settings load - #213

Merged
chadha-sridi merged 1 commit into
masterfrom
fix/validate-filter-conditions
Nov 24, 2026
Merged

chadha-sridi merged 1 commit into
masterfrom
fix/validate-filter-conditions

Conversation

@chadha-sridi

Copy link
Copy Markdown
Contributor

fix: reject unsupported filter conditions when settings load

Problem

Each entry in FILTERABLE_FIELDS has a field_type and a condition, but some pairs can't be turned into a Qdrant filter, for example keyword with >, float with ==, or boolean with <. Today the server starts anyway and exposes the field as a qdrant-find parameter. The error only shows up when the model uses that filter:

Error calling tool 'qdrant-find': Invalid condition > for keyword field metadata.lang

So whoever writes the config never sees the mistake, and the model gets a tool that fails every time it uses that parameter.

Changes

  • SUPPORTED_CONDITIONS in settings.py lists the conditions each field type supports, matching what make_filter accepts:

    • keyword: ==, !=, any, except
    • integer: all conditions
    • float: >, >=, <, <=
    • boolean: ==, !=
  • A validator on FilterableField rejects any other pair when the settings load, so the server doesn't start:

    Condition '>' is not supported for keyword field 'lang'. Supported conditions: ==, !=, any, except.
    

A config with an unsupported pair that used to start will now fail at startup. That filter never worked, so this only moves the error to where the config's author can see it.

Testing

  • New tests in tests/test_settings.py:
    • Every supported pair is accepted, and every unsupported pair is rejected.
    • Fields without a condition are accepted for every type.
    • Every pair is checked against make_filter, so the table can't drift from what make_filter supports.
    • An unsupported pair in the FILTERABLE_FIELDS env var fails when QdrantSettings loads, with the message above.
  • Full suite: 118 passed. pre-commit (ruff, ruff-format, isort, and mypy) passes.
  • Checked manually: on master, a server with keyword + > starts and fails on the first qdrant-find that uses the filter. With this change, it fails at startup with the message above.

🤖 Generated with Claude Code

@chadha-sridi
chadha-sridi merged commit d1f2416 into master Nov 24, 2026
5 checks passed
@chadha-sridi
chadha-sridi deleted the fix/validate-filter-conditions branch November 24, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants